package com.example.online_forum.exception;

import com.example.online_forum.common.AppResult;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * 自定义异常
 */

public class AppException extends RuntimeException{
    protected AppResult errorResult;
    public AppException(AppResult errorResult){
        super(errorResult.getMessage());
        this.errorResult = errorResult;
    }
    public AppResult getErrorResult() {
        return errorResult;
    }

    public AppException(String message) {
        super(message);
    }

    public AppException(String message, Throwable cause) {
        super(message, cause);
    }

    public AppException(Throwable cause) {
        super(cause);
    }
}
